import {GlobalInfo} from "../GlobalInfo"
export class DocService{
    static GetDocuments = async ():Promise<any[]>=>{
        var text = await GlobalInfo.getContent("/Doc/GetDocuments");
        return JSON.parse(text);
    }

    static GetDocContent = async (docId: any,version:any): Promise<string> => {
        try {
            var text = await GlobalInfo.getContent(`/docs/${docId}/index.html?v=${version}`);
            return text;
        }
        catch (e: any) {
            if (e.statusCode == 404) {
                return "";
            }
            else {
                throw e;
            }
        }
    }
}